//
//  SISSChoosePictureView.m
//  SISSAPP
//
//  Created by 袁应荣 on 2017/9/20.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSChoosePictureView.h"
#import "SISSUploadImageView.h"

@interface SISSChoosePictureView ()<SISSUploadImageViewDelegate>


@property (weak, nonatomic) UILabel *label;
@property (weak, nonatomic) SISSUploadImageView *uploadImageView;

@end
@implementation SISSChoosePictureView

- (void)setTitleStr:(NSString *)titleStr {
    _titleStr = titleStr;
    
    self.uploadImageView.titleStr = titleStr;
}

#pragma mark - SISSUploadImageViewDelegate
- (void)handlePhotoFinishedAction {
    self.images = self.uploadImageView.images;
}

#pragma mark - UI
- (void)initUI {
    [super initUI];
    
    self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    SISSUploadImageView *uploadImageView = [[SISSUploadImageView alloc] init];
    uploadImageView.titleStr = self.titleStr;
    uploadImageView.delegate = self;
    [self addSubview:uploadImageView];
    self.uploadImageView = uploadImageView;
    
    [uploadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self);
    }];
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    UIResponder *responder = self;
    UIViewController *viewController;
    while ((responder = [responder nextResponder])){
        if ([responder isKindOfClass: [UIViewController class]]) {
            viewController = (UIViewController *)responder;
            break;
        }
    }
    [viewController.view endEditing:YES];
}


@end
